using System;
using System.Collections.Generic;
using System.Text;

namespace Auditing.Business.Hashing
{
    public class SimpleHashCalculator : IHashCalculator
    {
        private const int SEED = 7;

        public int CalcHash(object value)
        {
            int res = SEED;

            if (value != null)
            {
                string strValue = value.ToString();

                foreach (char c in strValue.ToCharArray())
                {
                    res = res ^ Convert.ToInt32(c);
                }
            }

            return res;
        }
    }
}
